package com.rency.mtds.starter.client.holder;

/**
 * @author: caiyu.ren
 * Created on 2019/9/3 9:19
 * @version: V1.0.0
 * @since JDK 11
 */
public class DataSourceContextHolder {

    private static final ThreadLocal<String> LOOKUP_KEY_HOLDER = new ThreadLocal<>();

    private DataSourceContextHolder() {}

    public static String getDataSourceLookupKey() {
        return LOOKUP_KEY_HOLDER.get();
    }

    public static void setDataSourceLookupKey(String dataSourceLookupKey) {
        LOOKUP_KEY_HOLDER.set(dataSourceLookupKey);
    }

    public static void clearDataSourceLookupKey() {
        LOOKUP_KEY_HOLDER.remove();
    }
}
